﻿using LightingPlatform.Communication.ServiceReference1;
using System;
using System.Net;
using System.ServiceModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace LightingPlatform.Communication
{
    public static partial class Services
    {
        public static string ServicesUrl
        {
            get;
            set;
        }

        #region BusinessService
        private static LightingServiceSoapClient _lightingService;
        public static LightingServiceSoapClient LightingService
        {
            get
            {
                if (_lightingService == null)
                {

                    var binding = new BasicHttpBinding()
                    {
                        MaxBufferSize = int.MaxValue,
                        MaxReceivedMessageSize = int.MaxValue,
                        SendTimeout = TimeSpan.FromMinutes(10),
                        ReceiveTimeout = TimeSpan.FromMinutes(10),
                    };

                    _lightingService = new LightingServiceSoapClient(binding, new EndpointAddress(ServicesUrl + "/LightingService.asmx"));
                }

                return _lightingService;
            }
        }

        private static LightingServiceSoap LightingServiceInterface
        {
            get
            {
                return (LightingServiceSoap)LightingService;
            }
        }
        #endregion
    }
}
